//
//  GAKKIBasePageVesselViewController.h
//  GANGAIKit
//
//  Created by fh on 2019/11/15.
//  Copyright © 2019 cashchina. All rights reserved.
//

#import "GAKKIBaseViewController.h"
#import "SGPagingView.h"
@class GAKKIBasePageVesselViewController;

NS_ASSUME_NONNULL_BEGIN

/// 样式:后面的BasePageVesselViewStyleCustom代表自定义:需要实现相应的方法进行布局
typedef NS_ENUM(NSInteger, GAKKIBasePageVesselViewStyle) {
    GAKKIBasePageVesselViewStyleTopScrollBar,
    GAKKIBasePageVesselViewStyleCustom
};

/// 数据源
@protocol GAKKIBasePageVesselViewControllerDataSource <NSObject>

/// 有几个子控制器
/// @param basePageVesselViewController 容器
- (NSInteger)numberOfSubViewControllerForBasePageVesselViewController:(GAKKIBasePageVesselViewController *)basePageVesselViewController;

/// 第index下标的子控制器
/// @param basePageVesselViewController 容器
/// @param index 下标
- (GAKKIBaseViewController *)basePageVesselViewController:(GAKKIBasePageVesselViewController *)basePageVesselViewController subViewControllerForIndex:(NSInteger)index;

@end

/// 控制器容器基类
@interface GAKKIBasePageVesselViewController : GAKKIBaseViewController <GAKKIBasePageVesselViewControllerDataSource>
/// 数据源代理
@property (nonatomic, weak) id<GAKKIBasePageVesselViewControllerDataSource> dataSource;
/** 源数据 */
@property (nonatomic, strong) NSMutableArray<GAKKIBaseViewController *> *childPageControllers;
/** 当前的子控制器下标 */
@property (nonatomic, assign) NSInteger currentIndex;
/** 控制器view容器:用于给背景设置属性b，深度自定义布局等 */
@property (nonatomic, readonly, strong) UIScrollView *pageContentScrollView;

#pragma mark - Public
/// 重写创建对象
+ (instancetype)new;

/// 重写初始化
- (instancetype)init;

/// 重写用传递参数初始化
/// @param params 传递参数
- (instancetype)initWithParams:(NSDictionary * _Nullable)params;

/// 初始化1
/// @param style 样式
- (instancetype)initWithStyle:(GAKKIBasePageVesselViewStyle)style;

/// 初始化2
/// @param style 样式
/// @param params 参数
- (instancetype)initWithStyle:(GAKKIBasePageVesselViewStyle)style params:(NSDictionary * _Nullable)params;

/// 初始化3
/// @param style 样式
/// @param params 参数
/// @param dataSource 源数据
- (instancetype)initWithStyle:(GAKKIBasePageVesselViewStyle)style params:(NSDictionary * _Nullable)params dataSource:(NSMutableArray<GAKKIBaseViewController *> * _Nullable)dataSource;


/// 初始化设置:可以实现该方法进行一些初始化设置,比如属性样式配置...但是必须调用super
- (void)baseBasePageVesselViewControllerDefaultInitSetup;

/// 配置数据源:子类需要实现:即childPageControllers
- (void)configDataSource;

/// 深度自定义布局子类需要实现该方法进行布局
- (void)customSetupView;

/// 容器view的背景颜色
@property (nonatomic, readwrite, strong) UIColor *backgroundColor;

/// 子控制器已经出现的时候调用
/// @param childControllerIndex 子控制器下标
- (void)childControllerDidAppearWithChildControllerIndex:(NSInteger)childControllerIndex;

@end

NS_ASSUME_NONNULL_END
